240

Blockchain Technology

A larger number of transactions can be processed simultaneously with a larger block

size. Block attributes of a blockchain are described in Figure 14.3.

Data is stored in these blocks in the chain. Hashing algorithms are used for vary­

ing-length transactions to produce a fixed-length output and broadcast it to all the

users present in the network. In order to make the chain tamper proof, the previous

block’s hash is used to create the new block’s hash. The Merkle tree function is used

by bitcoin blockchain to generate a final hash value. This value is stored as the hash

of the current block, and each succeeding block stores the Merkle root of the previ­

ous block.

In order to avoid centralization, blockchain does not depend on atomic clocks

such as NTP (Network Time Protocol). So, each block contains a timestamp, which

signifies the block generation time. When a new block is received by a node, it checks

that that timestamp specified in the block doesn’t exceed UTC time by more than 100

ms. Blocks also store additional information such as signature, nonce value and other

user-defined data. Blockchain runs on a network of computers, which stores all the

data and updates in the blockchain. These computers are known as miners. These

miners perform the Proof of Work mechanism to achieve consensus.

Consensus function is a method of keeping the database consistent. A new trans­

action is validated only after the agreement of each blockchain node. The most

common consensus mechanism used by both bitcoin and Ethereum is Proof of

Work (PoW).

Proof of Work – A PoW mechanism is used to generate a piece of data that

is quite difficult to create but can be easily confirmed by others, satisfying

specific requirements. Difficulty is computed considering the computation

power, electricity and time consumption. PoW generation is a random pro­

cess having low probability and requires a lot of trial-and-error attempts

before generating a valid PoW. The Hash Cash PoW system is used by

bitcoin. The process of calculating this PoW data is called “mining”. The

“Nonce” value is a random value stored in the block headers. PoW requires

the Nonce value of the blocks to be exchanged in order to produce a value

that makes the hash value in the block header lower than a preset “difficulty

FIGURE 14.3  Attributes of a block in blockchain.